package com.hjxr.xmgl.EventFunction;

/**
 * @author: xk
 * @create: 2021-12-03 09:21
 * @description:
 **/
public class FunctionFactory {
    //使用 getEvent 获取函数的对象
    public EventFunction getEvent(String eventName){
        if(eventName == null){
            return null;
        }
        if(eventName.equalsIgnoreCase("add")){
            return new AddFuction();
        } else if(eventName.equalsIgnoreCase("reduce")){
            return new ReduceFunction();
        } else if(eventName.equalsIgnoreCase("multiply")){
            return new MultiplyFunction();
        }
        return null;
    }
}
